﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using eShop.Utility;
using eShop.Business;
using eShop.Model;

public partial class widget_site_banner : BaseWidget
{
    public void LoadWidget()
    {
        iBanner.Src = SiteGlobals.BaseUrl + ApplicationSettings.SiteBannerImage;
        if (!string.IsNullOrEmpty(CategoryPath))
        {
            iBanner.Src = SiteGlobals.BaseUrl + ApplicationSettings.CategoryDefaultBannerImage;
            Category category = CategoryManager.GetByCategoryUrl(CategoryPath);
            if (category != null && 
                !string.IsNullOrEmpty(category.CategoryBannerImageUrl))
            {

                iBanner.Src = SiteGlobals.BaseUrl + category.CategoryBannerImageUrl.Replace("~/", "");
            }
        }
    }

    public string CategoryPath { get; set; }
}